<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<script type="text/javascript">
	var artRoomGrid = null;
	var editRoomDialog = null;
	var showRoomDialog=null;
	$(function(){
		artRoomGrid = $("#art_Room_grid").ligerGrid({
				title : '展览馆列表',
                columns: [
                          {
                          	display: '<a href="javascript:;" onclick="addArtRoom()">添加展览馆</a>', 
                          	name: 'identifier',
                          	isAllowHide: false, 
                          	width: 300,
                          	isSort : false,
          					render: function (record, rowindex, value, column){
          						var html = '<a onclick="addArtPic(\''+ value + '\')" href="javascript:;">添加作品</a>&nbsp;<a onclick="showRoom(\''+ value + '\')" href="javascript:;">详情</a>&nbsp;<a onclick="updateRoom(\''+ value + '\')" href="javascript:;">修改</a>&nbsp;<a onclick="deleteRoom(\''+ value + '\')" href="javascript:;">删除</a>&nbsp;<a onclick="displayRoom(\''+ value + '\')" href="javascript:;">显示</a>&nbsp;<a onclick="hideRoom(\''+ value + '\')" href="javascript:;">关闭</a>&nbsp;<a onclick="addArtFlv(\''+ value + '\')" href="javascript:;">添加视频</a>&nbsp;'; 
          						return html; 
          					}
                          },
                          
				 { display: '当前状态', name: 'isShow',isSort : false,
	                  render: function(record, rowindex, value, column){
	                	  if(value){
	                		  return "<span>显示</span>"; 
	                	  }else{
	                		  return "<span>关闭</span>"; 
	                	  }
	                	 
	                  }},
	            { display: '展览馆编号', name: 'identifier',isSort : false,width: 100},
	            { display: '标题', name: 'title',isSort : false,width: 100},
                { display: '开始日期', name: 'startDate', isSort : false ,width: 100},
                { display: '结束日期', name: 'endDate', isSort : false,width: 100},
                { display: '开始时间', name: 'startTime', isSort : false,width: 100},
                { display: '结束时间', name: 'endTime', isSort : false,width: 100},
                {
                  	display: '<a href="javascript:;" onclick="addArtRoom()">封面</a>', 
                  	name: 'cover',
                  	isAllowHide: false, 
                  	width: 100,
                  	isSort : false,
  					render: function (record, rowindex, value, column){
  						var html = '<a href="'+ value + '" target="_blank">查看</a>'; 
  						return html; 
  					}
                  },
                { display: '创建时间', name: 'gmtCreated',isSort : false,
                  render: function(record, rowindex, value, column){
                	 return (new Date(value.time)).format("yyyy年MM月dd日 hh:mm:ss");
                  }}
              
                ], 
                pageSize:30,
                root :'list',
                record:'totalRecord',
                url: "/misc/artRoom/artRoomGrid.htm", 
                width: '99%',height:'99%',
                	isChecked: f_isChecked, onCheckRow: f_onCheckRow, onCheckAllRow: f_onCheckAllRow
            });


	});
	//添加展览馆
	function addArtRoom(){
		editRoomDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artRoom/addArtRoomWeb.htm", isResize: false ,modal:true,title:'添加艺术画'});
	
	}
	//删除展览馆
	function deleteRoom(roomId){
		$.post("/misc/artRoom/deleteRoom.htm", {
			roomId:roomId
		},function(data){
			if(data=="success"){
				artRoomGrid.loadData();
				$.ligerDialog.success("删除成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
	}
	//详细情况
	function showRoom(roomId){
		showRoomDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/index/showRoomDetail.htm?roomId="+roomId, isResize: false ,modal:true,title:'查看频道详情'});
	}
	function addArtPic(roomId){
		addArtPicDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artPic/addArtPicWeb.htm?type=room&classId="+roomId,isResize: false ,modal:true,title:'添加作品'});
	}
	//关闭/开启 展览馆
	function displayRoom(roomId){
		$.post("/misc/artRoom/displayRoom.htm", {
			identifier:roomId
		},function(data){
			if(data=="success"){
				artRoomGrid.loadData();
				$.ligerDialog.success("开启成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
	//
	function hideRoom(roomId){
		$.post("/misc/artRoom/hideRoom.htm", {
			identifier:roomId
		},function(data){
			if(data=="success"){
				artRoomGrid.loadData();
				$.ligerDialog.success("关闭成功！");
			}
			if(data=="error"){
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
		
	}
	//修改展览馆
	function updateRoom(id){
		editRoomDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artRoom/updateRoomWeb.htm?roomId="+id, isResize: false ,modal:true,title:'添加艺术画'});
	
	}
	//添加视频
	function addArtFlv(roomId){
		addArtPicDialog = $.ligerDialog.open({ height: 500,width:800, url: "/misc/artRoom/addFlv.htm?roomId="+roomId,isResize: false ,modal:true,title:'添加视频'});
	}
</script>
<div id="art_Room_grid" style="margin:0; padding:0"></div>
